package io.zcoder.innoway.commons;


import android.content.Context;
import android.content.SharedPreferences;

public class PrefUtils {

    public static final String PREF_NAME = "PREF_INNOWAY";
    public static final String PREF_AUTHEN_TOKEN = "PREF_AUTHEN_TOKEN";
    public static final String PREF_USER_ID = "PREF_USER_ID";
    public static final String PREF_PROFILE_ID = "PREF_PROFILE_ID";
    public static final String PREF_REMINDER_1 = "PREF_REMINDER_1";
    public static final String PREF_REMINDER_2 = "PREF_REMINDER_2";
    public static final String PREF_GOOGLE_FIT_STATUS = "PREF_REMINDER_2";

    public static void setString(Context context, String key, String value) {
        SharedPreferences sharedPreferences =
                context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(key, value);
        editor.apply();
    }

    public static String getString(Context context, String key) {
        SharedPreferences sharedPreferences =
                context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        return sharedPreferences.getString(key, "");
    }

    public static void setInt(Context context, String key, int value) {
        SharedPreferences sharedPreferences =
                context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt(key, value);
        editor.apply();
    }

    public static int getInt(Context context, String key) {
        SharedPreferences sharedPreferences =
                context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        return sharedPreferences.getInt(key, 0);
    }
}
